{% extends "index.html" %}

{% block content %}
    <div class="posts">
        <h2>Tag: {{ term.name }}</h2>
        {% if paginator is defined %}
            {% set pages = paginator.pages %}
        {% elif term is defined %}
            {% set pages = term.pages %}
        {% endif %}
        {% for page in pages %}
        <article class="post-entry">
            {{ post_macros::page_in_list(page=page)}}
        </article>
        {% endfor %}
        
        {% if paginator is defined %}
        <footer class="page-footer">
            <nav class="pagination">
                {% if paginator.previous %}
                    <a class="prev" href="{{ paginator.previous }}">← Previous</a>
                {% endif %}
                <!-- <span>Page {{ paginator.current_index }} of {{ paginator.number_pagers }}</span> -->
                {% if paginator.next %}
                    <a class="next" href="{{ paginator.next }}">Next →</a>
                {% endif %}
            </nav>
        </footer>
        {% endif %}
    </div>
{% endblock content %}
